package composite;

import java.util.ArrayList;
import java.util.List;

/**
 * 大学
 * @author DFD
 * @date 2023年11月17日
 */
public class University extends OrganizationComponent {
	private final List<OrganizationComponent> organizationComponents = new ArrayList<>();

	public University(String name, String desc) {
		super(name, desc);
	}

	@Override
	protected void print() {
		System.out.println("--------------" + getName() + "--------------所有学院如下");
		// 遍历 organizationComponents
		for (OrganizationComponent organizationComponent : organizationComponents) {
			organizationComponent.print();
		}
	}

	@Override
	protected void add(OrganizationComponent organizationComponent) {
		organizationComponents.add(organizationComponent);
	}

	@Override
	protected void remove(OrganizationComponent organizationComponent) {
		organizationComponents.remove(organizationComponent);
	}

}
